package com.lm.netdemo01;

import java.io.*;
import java.net.Socket;

public class LiminClient {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("192.168.2.2",8888);

        System.out.println("客户端启动!!!");

        OutputStream os = socket.getOutputStream();
        DataOutputStream dos = new DataOutputStream(os);

        dos.writeUTF("你好,我是客户端!!!");

        InputStream is = socket.getInputStream();
        DataInputStream dis = new DataInputStream(is);
        String str = dis.readUTF();
        System.out.println("服务端:"+str);

        os.close();
        is.close();
        socket.close();
    }
}
